#include <iostream>  // std::cout
#include <algorithm> // std::all_of
#include <array>     // std::array
#include <vector>

void all_of() // 判断一个序列的[所有元素]是否符合条件
{
    std::array<int, 9> foo = {3, 5, 7, 11, 13, 17, 19, 23, 20};

    if (std::all_of(foo.begin(), foo.end(), [](int i)
                    { return i % 2; }))
        std::cout << "All the elements are odd numbers.\n";
    else
        std::cout << "There is even number in the foo array.\n";
}

void any_of() // 判断一个序列的[任意一个元素]是否符合条件
{
    std::vector<int> v = {1, 2, 3, 4, 5, 6};
    if (std::any_of(v.begin(), v.end(), [](int i)
                    { return i < 0; }))
        std::cout << "There is element less than zero.\n";
    else
        std::cout << "All the elements are better than zero.\n";
}

void none_of() // 判断一个序列的[所有元素]是否都不符合条件
{
    std::array<int, 8> foo = {1, 2, 4, 8, 16, 32, 64, 128};

    if (std::none_of(foo.begin(), foo.end(), [](int i)
                     { return i < 0; }))
        std::cout << "There are no negative elements in the range.\n";
}

int main()
{
    any_of();
    return 0;
}